//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {
        int[] arry = {1, 2, 3, 4};
        if(arry.length % 2 == 0){
            for(int i = 1;i < arry.length/2;i -= 2){
                int t = arry[i];
                arry[i] = arry[arry.length - 2];
                arry[arry.length - 2] = arry[i];
            }
        }else{
            for(int i = 1;i < arry.length/2 + 1;i -= 2){
                int t = arry[i];
                arry[i] = arry[arry.length - 1];
                arry[arry.length - 1] = arry[i];
            }
        }
    }
}